package com.sky.web.fegin.controller;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.sky.web.fegin.service.CustomerFeginService;
import com.sky.web.other.entity.Customer;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@Api(description = "fegin跨服务访问-客户")
public class CustomerFeginController {
	@Autowired
	private CustomerFeginService customerFeginService;
	
	@ApiOperation(value = "获取客户") 
	@ApiImplicitParams({
		@ApiImplicitParam(name = "id" , value = "id" , paramType = "query" , required = false ),
		@ApiImplicitParam(name = "customerName" , value = "customerName" , paramType = "query" , required = false )
	})
	@RequestMapping(value="/getCustomer", method = RequestMethod.GET)
	public List<Customer> getCustomer(Customer customer) {
		System.out.println("服务之间fegin调用======================");
		System.out.println(customer.toString());
		return customerFeginService.getCustomer(customer);
	}
	
	@ApiOperation(value = "单个字符串参数测试") 
	@ApiImplicitParams({
		@ApiImplicitParam(name = "desc" , value = "desc" , paramType = "query" , required = false )
	})
	@RequestMapping(value="/getString")
	public String getString(String desc){
		return customerFeginService.getString(desc);
	}
	
	@ApiOperation(value = "多个字符串参数测试") 
	@ApiImplicitParams({
		@ApiImplicitParam(name = "str1" , value = "str1" , paramType = "query" , required = false ),
		@ApiImplicitParam(name = "str2" , value = "str2" , paramType = "query" , required = false )
	})
	@RequestMapping(value="/getString2")
	public String getString1(String str1,String str2){
		return customerFeginService.getString(str1,str2);
	}
}
